import * as PIXI from 'pixi.js';
import { timeTween } from './timeTween';
/**
 * 淡入
 * @param ticker
 * @param container
 * @param time
 */
export async function zoom(
  ticker: PIXI.Ticker,
  container: PIXI.Container,
  direction: Direction = Direction.LEFT2RIGHT,
  time = 500,
) {
  container.visible = true;
  container.alpha = 1;
  const width = container.width;
  container.width = 0
  await timeTween(ticker, [0], [width], time, (p) => container.width = p[0])
  container.width = width;
}

export enum Direction {
  LEFT2RIGHT,
  RIGHT2LEFT,
  TOP2BOTTOM,
  BOTTOM2TOP,
}
